package com.evan.common.core.constant;

public enum MaterialTypeEnum {

    RICH_TEXT(1, "富文本"),VIDEO(2, "视频"),DOC(3, "文档"),IMAGE(4, "图片");

    private int code;
    private String name;

    MaterialTypeEnum(int code, String name) {
        this.code = code;
        this.name = name;
    }

    public int getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

    public static MaterialTypeEnum getByCode(int code) {
        for (MaterialTypeEnum materialTypeEnum : values()) {
            if (materialTypeEnum.getCode() == code) {
                return materialTypeEnum;
            }
        }
        return null;
    }

    public static MaterialTypeEnum getByName(String name) {
        for (MaterialTypeEnum materialTypeEnum : values()) {
            if (materialTypeEnum.getName().equals(name)) {
                return materialTypeEnum;
            }
        }
        return null;
    }
}
